package com.ruoyi.edh.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.edh.domain.EdhCategories;
import com.ruoyi.edh.domain.vo.EdhCategoriesVo;
import com.ruoyi.edh.mapper.EdhCategoriesMapper;
import com.ruoyi.edh.service.IEdhCategoriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 易订货-分类Service业务层处理
 * 
 * @author xxx
 * @date 2020-09-02
 */
@Service
public class EdhCategoriesServiceImpl implements IEdhCategoriesService
{
    @Autowired
    private EdhCategoriesMapper edhCategoriesMapper;

    /**
     * 查询易订货-分类
     * 
     * @param id 易订货-分类ID
     * @return 易订货-分类
     */
    @Override
    public EdhCategories selectEdhCategoriesById(Long id)
    {
        return edhCategoriesMapper.selectEdhCategoriesById(id);
    }

    /**
     * 查询一级分类接口
     * @return
     */
    @Override
    public List<EdhCategories> selectEdhTopCategoriesList() {
        return edhCategoriesMapper.selectEdhTopCategoriesList();
    }

    /**
     * 查询全部分类接口
     * @return
     */
    @Override
    public List<EdhCategoriesVo> selectEdhAllCategoriesList() {
        return edhCategoriesMapper.selectEdhAllCategoriesList();
    }
    /**
     *
     *
     * @description:查询热卖专区分类列表
     * @return: 分类信息list
     * @author: 梁东宸
     * @time: 2020/10/15 10:23 上午
     */
    @Override
    public List<EdhCategories> selectHotCategoriesList() {
        return edhCategoriesMapper.selectHotCategoriesList();
    }


    /**
     * 查询易订货-分类列表
     * 
     * @param edhCategories 易订货-分类
     * @return 易订货-分类
     */
    @Override
    public List<EdhCategories> selectEdhCategoriesList(EdhCategories edhCategories)
    {
        return edhCategoriesMapper.selectEdhCategoriesList(edhCategories);
    }

    /**
     * 新增易订货-分类
     * 
     * @param edhCategories 易订货-分类
     * @return 结果
     */
    @Override
    public int insertEdhCategories(EdhCategories edhCategories)
    {
        edhCategories.setCreateBy(SecurityUtils.getUserId().toString());
        edhCategories.setCreateTime(DateUtils.getNowDate());
        return edhCategoriesMapper.insertEdhCategories(edhCategories);
    }

    /**
     * 修改易订货-分类
     * 
     * @param edhCategories 易订货-分类
     * @return 结果
     */
    @Override
    public int updateEdhCategories(EdhCategories edhCategories)
    {
        edhCategories.setUpdateBy(SecurityUtils.getUserId().toString());
        edhCategories.setUpdateTime(DateUtils.getNowDate());
        return edhCategoriesMapper.updateEdhCategories(edhCategories);
    }

    /**
     * 批量删除易订货-分类
     * 
     * @param ids 需要删除的易订货-分类ID
     * @return 结果
     */
    @Override
    public int deleteEdhCategoriesByIds(Long[] ids)
    {
        return edhCategoriesMapper.deleteEdhCategoriesByIds(ids);
    }

    /**
     * 删除易订货-分类信息
     * 
     * @param id 易订货-分类ID
     * @return 结果
     */
    @Override
    public int deleteEdhCategoriesById(Long id)
    {
        return edhCategoriesMapper.deleteEdhCategoriesById(id);
    }
}
